<include file="public@header" />

</head>
<body>
<div class="wrap js-check-wrap">
	<ul class="nav nav-tabs">
        <li><a href="{:url('StoreCat/index')}">店铺类别列表</a></li>
		<li class="active"><a href="{:url('StoreCat/add')}">新增店铺类别</a></li>
    </ul>
    <form class="form-horizontal js-ajax-form margin-top-20" role="form" action="" method="post">
        <fieldset>
            <div class="tabbable">
                <div class="tab-content">
                    <div class="tab-pane active" id="A">
                         <div class="form-group">
                            <label  class="col-sm-2 control-label"><span class="form-required">*</span>类别名称</label>
                            <div class="col-md-6 col-sm-10">
                                <input type="text" class="form-control" id="input-code" name="cat_name" value="">
                            </div>
                        </div> 
                        <div class="form-group">
                            <label  class="col-sm-2 control-label"><span class="form-required">*</span>加盟费</label>
                            <div class="col-md-6 col-sm-10">
                                <input type="text" class="form-control" id="input-name" name="franchise_fee" value="">
                            </div>
                        </div>
                        <div class="form-group">
                            <label  class="col-sm-2 control-label"><span class="form-required">*</span>选择类别商品</label>
                            <div class="col-md-6 col-sm-10"> 
                                <foreach name="goods_list" item="vo" >          
                                <input type="checkbox" name="cat"   value="{$vo.g_id}">{$vo.g_goodsname}
                                </foreach>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-primary js-ajax-submit" data-refresh="0"   onclick="fun()">{:lang('SAVE')}</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </fieldset>
    </form>
</div>
<script type="text/javascript">
function fun(){
    obj = document.getElementsByName("cat");
    check_val = [];
    for(k in obj){
        if(obj[k].checked)
            check_val.push(obj[k].value);
    }
    var id_str=check_val;
    var cat_name=$('input[name=cat_name]').val();
    var franchise_fee=$('input[name=franchise_fee]').val();    
    $.getJSON("{:url('StoreCat/addPost')}",{franchise_fee:franchise_fee,cat_name:cat_name,id_str:id_str},function(json){
    	alert(json.msg);
    	window.location.reload();
	});  
}
</script>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
</body>
</html>